﻿<navigation:Page x:Class="DemoDataGridToolBar.Views.RIA_dir_edit" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

		xmlns:riac="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
		xmlns:domain="clr-namespace:AdventureWorksService.Web;assembly=AdventureWorksService"
		xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"						 
		xmlns:mac="clr-namespace:System.Windows.Controls;assembly=Slma.Windows.Controls"
		xmlns:mar="clr-namespace:System.Windows.Controls;assembly=Slma.Windows.Controls.RIA"
								 
					 mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="800" d:DesignHeight="480"
           Title="RIA_dir_edit Page">
	
    <Grid x:Name="LayoutRoot">
			
			<riac:DomainDataSource x:Name="dsProducts" AutoLoad="True" QueryName="GetProduct" LoadSize="30" >
			<riac:DomainDataSource.DomainContext>
				<domain:AdventureWorksDomainContext />
			</riac:DomainDataSource.DomainContext>
			<riac:DomainDataSource.SortDescriptors>
				<riac:SortDescriptor PropertyPath="Name" Direction="Ascending" />
			</riac:DomainDataSource.SortDescriptors>
		</riac:DomainDataSource>

		<StackPanel Orientation="Vertical" Margin="0,20,0,0" Width="800">
			<CheckBox  IsChecked="{Binding ElementName=tb1, Path=AutoSubmit, Mode=TwoWay}" Content="{StaticResource ls_auto_submit}" />	
			<mar:DataGridToolBarRIA  
        x:Name="tb1" Height="45" Margin="0,0,0,2" AutoSubmit="False" ButtonAddNewVisible="True" ButtonEditVisible="True"
				DataGrid="{ Binding ElementName=dgProducts, Mode=OneTime }"	
				DomainDataSource="{ Binding ElementName=dsProducts, Mode=OneTime}"
				CreateDataForm="DataGridToolBarRIA_CreateDataForm"															 
				>
				<mar:DataGridToolBarRIA.ColumnsForFiltering>
					<mac:DataGridToolBarFilterItem ColumnName="Name"  />
					<mac:DataGridToolBarFilterItem ColumnName="ProductNumber"  />
					<mac:DataGridToolBarFilterItem ColumnName="Color"  />
					<mac:DataGridToolBarFilterItem ColumnName="Size"  />
					<mac:DataGridToolBarFilterItem ColumnName="ListPrice"  />
					<mac:DataGridToolBarFilterItem ColumnName="Weight"  />
					<mac:DataGridToolBarFilterItem ColumnName="SellStartDate"  />
				</mar:DataGridToolBarRIA.ColumnsForFiltering>
				<mar:DataGridToolBarRIA.Content>
					<data:DataPager x:Name="dpTest" PageSize="10" Source="{Binding ElementName=dsProducts, Path=Data}" BorderThickness="0" Background="Transparent" ></data:DataPager>
				</mar:DataGridToolBarRIA.Content>
			</mar:DataGridToolBarRIA>


			<mac:maDataGrid x:Name="dgProducts" Height="300" AutoGenerateColumns="False" 	  
				IsReadOnly="False"							
				ItemsSource="{Binding ElementName=dsProducts, Path=Data }"
				>
				<data:DataGrid.Columns>
					<data:DataGridTextColumn Header="{StaticResource ls_product_name}"
						Width="150" MaxWidth="300" MinWidth="40" 
						Binding="{Binding Name}" />
					<data:DataGridTextColumn Header="{StaticResource ls_product_poductnumber}"
						Width="120" MaxWidth="300" MinWidth="40" 
						Binding="{Binding ProductNumber}"/>
					<data:DataGridTextColumn Header="{StaticResource ls_product_color}"
						Width="70" MaxWidth="300" MinWidth="30" 
						Binding="{Binding Color, Mode=TwoWay}"/>
					<data:DataGridTextColumn Header="{StaticResource ls_product_size}"
						Width="70" MaxWidth="300" MinWidth="30" 
						Binding="{Binding Size}"  ElementStyle="{StaticResource ElementStyle_right}"/>
					<data:DataGridTextColumn Header="{StaticResource ls_product_listprice}"
						Width="90" MaxWidth="300" MinWidth="30" 
						Binding="{Binding ListPrice }" ElementStyle="{StaticResource ElementStyle_right}" />
					<data:DataGridTextColumn Header="{StaticResource ls_product_weight}"
						Width="70" MaxWidth="300" MinWidth="30" 
						Binding="{Binding Weight}"  ElementStyle="{StaticResource ElementStyle_right}">
					</data:DataGridTextColumn>
					<data:DataGridTextColumn Header="{StaticResource ls_product_sellstartdate}"
						Width="100" MaxWidth="300" MinWidth="30" 
						Binding="{Binding SellStartDate, StringFormat=d}"  ElementStyle="{StaticResource ElementStyle_right}"/>
				</data:DataGrid.Columns>
			</mac:maDataGrid>

		</StackPanel>
	</Grid>
</navigation:Page>
